<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Block extends My_Controller {
    
    public function __construct() {
        parent::__construct();
    }

    /**
     * Index Page for this controller.
     
     */
    public function index() {
        //Add css into template
        $dataView['imageFrontPath'] = $this->_config['base_url'] . $this->_staticPathPublic . 'images';
        $this->template->parse_view('content', $this->_viewFront . 'home_view', $dataView);
        $this->template->render();
    }

    /**
     * @desc Block content
     */
    public function bsec() {
        //Params
        $sectionId = $this->_config['news_sectionid'];
        $arrInput = array(
            'sectionid' => $sectionId    //News
        );

        //Init instance
        $CI = get_instance();

        //Load section model
        $CI->load->model('frontend/Node_model', 'Node', TRUE);
        $resultNode = $CI->Node->nod_GetNodeBySectionID($arrInput);

        $countNode = count($resultNode);

        if ($countNode > 0) {
            $CI->load->model('frontend/article_model', 'Article', TRUE);
            
            foreach ($resultNode as $key => $val) {
                $arrInput['parentnode'] = $val->parentnode;
                $resultArt[$val->nodeid] = $CI->Article->arc_GetNewestByNodeId($arrInput);
            }

            echo '<pre>';
            print_r($resultArt);
        }
        print_r($resultNode);
        die('Debug');
    }
    
    public function sec() {
        $arrInput = array(
            'sectionid' => 45
        );
        $CI = get_instance();
        $CI->load->model('frontend/section_model', 'Section', TRUE);
        $result = $CI->Section->sec_GetALLSection(NULL);
        echo "<pre>";
        print_r($result);
        echo "</pre>";
        die('Debug');
    }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */